package com.liuqm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liuqm.mapper.CzktProductClassMapper;
import com.liuqm.pojo.CzktProductClass;
import com.liuqm.service.ICzktProductClassService;
import com.liuqm.service.ICzktProductClassService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 商品分类 服务实现类
 * </p>
 *
 * @author liuqm
 * @since 2024-09-04
 */
@Service
public class CzktProductClassServiceImpl extends ServiceImpl<CzktProductClassMapper, CzktProductClass> implements ICzktProductClassService {

    @Override
    public List<CzktProductClass> list(Integer pid) {

        LambdaQueryWrapper<CzktProductClass> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(pid!=null,CzktProductClass::getParentId,pid);

        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<CzktProductClass> list(Set<Integer> pids) {

        LambdaQueryWrapper<CzktProductClass> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(!pids.isEmpty(),CzktProductClass::getParentId,pids);

        return baseMapper.selectList(queryWrapper);
    }
}
